<?php

namespace app\api\controller\v5;

use app\api\controller\v2\Auth;

class AstroData extends Auth
{
    /**
     * 获取星盘配置
     */
    public function read()
    {
        return show(config('code.error'), '请下载最新版APP以使用此功能！');
        $datetime = htmlspecialchars(input('param.datetime'));
        $id = input('param.id/d', 0);
        $timezone = input('param.timezone/d', 8);
        $chart = htmlspecialchars(input('param.chart'));
        $tid = input('param.tid/d', 1);
        $longitude = number_format(floatval(input('param.longitude')), 8);
        $latitude = number_format(floatval(input('param.latitude')), 8);

        $id1 = input('param.id1/d');
        $id2 = input('param.id2/d');


        $Astro = new Astro();

        switch ($chart)
        {
            case 'now':
                $nowModel = new Now();
                $details = $nowModel->get(['tid' => $tid, 'timezone' => $timezone, 'longitude' => $longitude, 'latitude' => $latitude, 'datetime' => $datetime]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'natal':
                $natalModel = new Natal();
                $details = $natalModel->get(['id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success', $details);
                break;
            case 'transits':
                $details = $Astro->transits($datetime, $timezone, $id, $tid, true);
                return show(config('code.success'), 'Success', $details);
                break;
            case 'thirdprogressed':
                $details = $Astro->thirdprogressed($datetime, false, $timezone, $id, $tid, true);
                return show(config('code.success'), 'Success', $details);
                break;
            case 'progressions':
                $details = $Astro->progressions(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'progressionsvsnatal':
                $details = $Astro->progressionsvsnatal(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'solar':
                $details = $Astro->solar(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'solar_return':
                $details = $Astro->solar_return(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'lunar_return':
                $details = $Astro->lunar_return(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'firdaria':
                $firdariaModel = new Firdaria();
                $details = $firdariaModel->get(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'profection':
                $profectionModel = new Profection();
                $details = $profectionModel->get(['datetime' => $datetime, 'timezone' => $timezone, 'id' => $id, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'synastry':
                $synastryModel = new Synastry();
                $details = $synastryModel->get(['id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'composite':
                $details = $Astro->composite(['id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'composite_thirdprogressed':
                $details = $Astro->composite_thirdprogressed(['datetime' => $datetime, 'timezone' => $timezone, 'id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'composite_progressions':
                $details = $Astro->composite_progressions(['datetime' => $datetime, 'timezone' => $timezone, 'id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'davison':
                $details = $Astro->davison(['id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
            case 'marks':
                $details = $Astro->marks(['id1' => $id1, 'id2' => $id2, 'tid' => $tid]);
                return show(config('code.success'), 'Success.', $details);
                break;
        }

    }
}
